<%@ page language="java" pageEncoding="utf-8" %>
<%@ page import="com.yungu.swift.api.wxapi.pojo.SNSUserInfo ,java.lang.*" %>
<%
    SNSUserInfo user = (SNSUserInfo) request.getSession().getAttribute("snsUserInfo");
    if(user!=null){
        session.setAttribute("openId", user.getOpenId());
        session.setAttribute("nickName", user.getNickname());
        session.setAttribute("sex", user.getSex());
        session.setAttribute("image",user.getHeadImgUrl());
    }
    String path = request.getContextPath();
    session.setAttribute("path", path);
%>
<!DOCTYPE html>
<html>
<head>
    <%@include file="../common/base.jsp"%>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1"/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
    <meta http-equiv="expires" content="0">
    <%--<title>${appName}</title>--%>
    <title>${appName}</title>
    <link rel="stylesheet" type="text/css" href="${base}/css/bootstrap.min.css">
    <!--城市选择css-->
    <link rel="stylesheet" href="${base}/plugin/cityselect/css/LArea.min.css">
    <!--单列选择-->
    <link rel="stylesheet" href="${base}/plugin/iosselect-master/src/iosSelect.css">

    <link rel="stylesheet" type="text/css" href="${base}/plugin/citysearch/citysearch.css?version=${version}">
    <!---->
    <link rel="stylesheet" type="text/css" href="${base}/css/global.css?version=${version}">
    <link rel="stylesheet" type="text/css" href="${base}/css/index.css?version=${version}">
    <style type="text/css">
        .input {
            -webkit-appearance: none;
            -moz-appearance: none;
            -o-appearance: none;
            appearance: none;
            background-color: #ffffff;
        }

        #historyBox {
            position: fixed;
            top: 50px;
            left: 0;
        }
        /*@media screen and (min-height: 650px) {*/
            /*body {*/
                /*overflow-x:hidden;*/
            /*}*/
        /*}*/

        /*.layui-layer {*/
            /*-webkit-border-radius: 0px !important;*/
            /*-moz-border-radius: 0px !important;*/
            /*border-radius: 0px !important;*/
        /*}*/

        .closeExtraDiv {
            position: fixed;
            text-align: center;
        }

        .layui-layer-msg{
            background-color: #585858 !important;
        }

        body{
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            min-height: 650px;
        }
        .tips{
            margin-top: 15px;
            margin-bottom: 40px;
            margin-left:30px;
        }
        .containerBox .btn-call {
            position: absolute;
            bottom:10px;
        }
        /*标题提示样式*/
        .container-fluid .tips{
            font-size:20px;
            font-family:PingFang-SC-Regular;
            color:rgba(107,120,134,1);
            line-height:25px;
        }
        /*信息容器样式*/
        .info-container{
            box-shadow: 1px 1px 6px 0px #9d9d9d;
            font-family:PingFangSC-Regular !important;
        }
        /*时间选择栏样式*/
        .info-container #setoutTime{
            font-size:12px;
            line-height:33px;
            color:rgba(107,120,134,1);
            display: inline-block;

        }
        #timeshow{
            font-family:PingFangSC-Regular;
        }

        /*img{*/
            /*width:60%;*/
        /*}*/
        /*换乘人栏样式*/
        .info-container #changeCustomer{
            font-size:14px;
            line-height:33px;
            color:rgba(107,120,134,1);
            display: inline-block;
        }
        /*调度费栏目样式*/
        .info-container #dispatch{
            font-size:14px;
            line-height:33px;
            color:rgba(107,120,134,1);
            display: inline-block;
        }
        /*捎话栏目样式*/
        .info-container #oralMessage{
            font-size:14px;
            line-height:33px;
            color:rgba(107,120,134,1);
            display: inline-block;
        }
        .info-container #oralMessage #oralMessageSpan{
            display: inline-block;
            max-width: 80px;
            overflow: hidden;
            text-overflow: ellipsis;
            vertical-align: top;
            /* word-wrap: break-word; */
            white-space: nowrap;
        }
        /*栏目样式*/
        .info-container .stable{
            margin: 0;
            padding: 4px 0px;
            text-align: center;
            border-top: 1px solid #e4e7ea;
            border-bottom: 1px solid #e4e7ea;
            border-radius: 3px;

        }
        .stable .p:first-child{
            border-right:1px solid #e4e7ea;
        }
        .layui-layer{
            overflow: hidden;
        }
        .layui-layer-content{
            position: relative;
            border-bottom-left-radius: 10px;
            border-bottom-right-radius: 10px;
            overflow: hidden;
        }
        .closeExtraDiv{
            /*display: none;*/
        }
        .layui-layer-title{
            height: 30px;
            line-height: 30px;
        }
        .f-pointer{
            cursor: pointer;
        }

        .z-icon{
            display: inline-block;
        }
        .z-icon:before{
           content: "";
           background-size: 100%;
           background-repeat: no-repeat;
           width:12px;
           height:12px;
            display: inline-block;
        }
        .z-icon.icon1:before{
            background-image: url('');
        }
        .z-icon.icon2:before{
            background-image: url('');
        }
        .z-icon.icon3:before{
            background-image: url('');
        }
        .z-icon.icon4:before{
            background-image: url('');
        }
    </style>
</head>
<body >
<input type="hidden" value="" id="inputId">
<input type="hidden" value="0" id="valueTo">
<input type="hidden" value="" id="curLocation">
<input type="hidden" value="${sessionScope.passengerUuid}" id="passengerUuid">
<div id="container" class="hide">

</div>
<div id="searchBox" class="container-fluid">

</div>
<div id="mask"></div>
<div id="historyBox" class=""></div>
<div id="containerBox" class="container-fluid">
    <%@include file="./include/header.jsp" %>
    <%--<div class="header clearfix text-center">--%>
        <%--<div class="pull-left">--%>
            <%--<div class="user-face-icon">--%>
                <%--<img class="img" src="${base}/images/man.png">--%>
            <%--</div>--%>
        <%--</div>--%>

    <%--</div>--%>
    <p class="text-center tips">您好，您现在想去哪儿？</p>
    <div class="info-container">
        <div class="row stable">
            <p id="setoutTime"  class="text-center setoutTime col-xs-6 time p" >
                <span class="z-icon icon1">
                    <span id="timeshow" class="timeshow">现在</span>
                </span>
            </p>
            <%--<p id="sperate">|</p>--%>
            <p id="changeCustomer" class="text-center col-xs-6 p">
                <span class="z-icon icon2">
                    <span id="changeCustomerSpan">换乘车人</span>
                </span>
            </p>
        </div>

        <div class="row stable">
            <p id="dispatch" class="col-xs-6 p f-pointer">
                <span  class="z-icon icon3">
                    <span id="dispatchSpan">调度费</span>
                </span>
            </p>
             <p id="oralMessage" class="col-xs-6 p f-pointer">
                <span class="z-icon icon4">
                    <span id="oralMessageSpan" >捎话</span>
                </span>
            </p>
        </div>
        <%--选择出发地和目的地--%>
        <div>
            <ul class="addr-inputs beyhide">
                <li class="li qidian">
                    <img class="img" src="${base}/images/qidian.png">
                    <span class="input qidian-input" id="qidian_input" style="display: inline-block;">您从哪上车</span>
                </li>
                <li class="li zhongdian">
                    <img class="img" src="${base}/images/zhongdian.png">
                    <span id="zhongdian_input" class="input" style="display: inline-block;">您要去哪儿</span>
                </li>
            </ul>
        </div>
        <%--计价提示栏目--%>
        <div class="" style="text-align: center;">
            <div style="display: inline-block;">
                <img class="img" src="${base}/images/car_taxi.png" style="width:60%;"/>
                <p class="text-center cost fare-info" >计价器计价</p>
                <p class="text-center sub" id="actPaid">(发票请向司机索取)</p>
            </div>
        </div>
    </div>
    <div class="btn-call btn-call-disabled btn-call-taxi" style="text-decoration:none;">呼叫出租车</div>




</div>
<%--侧边导航--%>
<div class="nav_mask"></div>
<div class="l-left-nav">
    <div class="user-info">
        <div class="user-face"><img src="${image}" class="" alt=""></div>
        <div class="user-name"> ${nickName} </div>
        <div class="user-mobile"></div>
    </div>
    <div class="Rectangle-16-Copy-6"></div>
    <div class="nav-list">
        <a href="${base}/yue/order_list" class="trip">我的行程</a>
        <a href="${base}/yue/couponlist" class="couponlist">优惠券</a>
        <a href="javascript:void(0)" class="exit" id="exit">退出</a>
    </div>
</div>
<div class="l-footer" style="position: absolute;">
    <%@include file="footer.jsp"%>
</div>


</body>
<script type="text/javascript" src="${base}/js/jquery.min.js"></script>
<script type="text/javascript" src="${base}/plugin/layer-v3.0.3/layer.js"></script>

<script type="text/javascript"
        src="https://webapi.amap.com/maps?v=1.3&key=55897440ff54932c599cc73b9b4baf1c&plugin=AMap.Autocomplete,AMap.PlaceSearch,AMap.Driving,AMap.CitySearch,AMap.Geolocation"></script>
<script src="${base}/plugin/cityselect/js/LAreaData1.js?version=${version}" type="text/javascript"></script>
<script src="${base}/plugin/cityselect/js/LArea.js?version=${version}" type="text/javascript"></script>

<script src="${base}/js/carType.js"></script>
<script src="${base}/plugin/iosselect-master/src/iscroll.js"></script>
<script src="${base}/plugin/iosselect-master/src/iosSelect.js"></script>
<script src="${base}/plugin/iosselect-master/flexible.js"></script>
<script src="${base}/plugin/iosselect-master/navbarscroll.js"></script>

<script type="text/javascript" src="${base}/js/localStorageOpt.js?version=${version}"></script>
<script type="text/javascript" src="${base}/js/constant.js?version=${version}"></script>
<script type="text/javascript" src="${base}/js/position.js?version=${version}"></script>
<script type="text/javascript" src="${base}/js/utils.js?version=${version}"></script>

<script type="text/javascript" src="${base}/js/search.js?version=${version}"></script>

<script type="text/javascript" src="${base}/plugin/citysearch/citysearch.js?version=${version}"></script>
<script>
    <%--$('.wrapper').navbarscroll();--%>
    <%--setLocalStorage('openId','${openId}' || getLocalStorage('openId'))--%>
    <%--setLocalStorage('isTaxi','true')//保存缓存页面类型--%>
    <%--setLocalStorage('typeModel','1')--%>
    <%--delLocalStorage("isH5");--%>
    <%--delLocalStorage("yueuserH5")--%>
    <%--delLocalStorage('actualMobile');//删除换乘人电话号码--%>
    <%--$(".user-face").find('img').attr("src", "${image}" || "${base}/images/man.png");--%>
    <%--$(".user-name").html("${nickName}" || "未填写");--%>
</script>
<script type="text/javascript">
    <%--var yun=new yueajax( "${openId}",'validateOpenId');--%>
    <%--var openId1=${sessionScope.snsUserInfo.openId};--%>
    var yun = new yueajax("${openId}");
    (function () {
      setLocalStorage('ifBindWxUser', "false")
      setLocalStorage('isH5', "true")
      delLocalStorage("yueuser")
      var us = getLocalStorage("yueuserH5", "object");
      if (!!us) {
        setLocalStorage('ifBindWxUser', "true")
        $(".user-face").find('img').attr("src", us.face || "${base}/images/man.png");
        $(".user-name").html(us.nickname || "未填写");
        $(".user-mobile").html((us.mobile).replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'));

        yun.ajax_md5(
          {token: us.token},
          "/api/v1/passenger/token/order/status",
          function (data) {
            var d = data.data;
            if (!d) {
              setLocalStorage('ifBindWxUser', false)
              delLocalStorage('yueuserH5')
              changeUrl("index");
              return;
            }
            if (d.status != 0) {
              setLocalStorage('subStatus', d.subStatus);
              changeUrl(d.subStatus, d.orderUuid + '&status=' + d.status);
            }
          },
          function (data) {
            setLocalStorage('ifBindWxUser', false)
            delLocalStorage('yueuserH5')
            changeUrl("index");
          }
        )
      }
    })()
    delLocalStorage('actualMobile');//删除换乘人电话号码
    var $document = $(document);
    // 初始化起点定位数据
    initStartInputData();
    // 浏览器回退监听
    pushHistory('${appName}', '#');
    window.addEventListener("popstate", function (e) {
//            cancelInputOrBack();
        letShow();
    }, false);
    // 初始化--出发时间选择
    var area1 = new LArea();
    area1.init({
        'trigger': '#timeshow', //触发选择控件的文本框，同时选择完毕后name属性输出到该位置
        'valueTo': '#valueTo', //选择完毕后id属性输出到该位置
        'keys': {
            id: 'id',
            name: 'name'
        }, //绑定数据源相关字段id对应valueTo的value属性输出name对应trigger的value属性输出
        'type': 1, //数据源类型
        'data': LAreaData, //数据源
        clickFinish:function(){
            calculate(yun);
        }
    });
    //侧边栏
    $document.on('touchend', '.user-face-icon', function () {
        var isBind = getLocalStorage('ifBindWxUser', 'string');
        if (isBind == 'false' || isBind==null) {
            setTimeout(function(){
                layer.open({
                    type: 2,
                    title: "验证手机号，方便司机联系您",
                    area: ['92%', '235px'], //宽高,
                    shadeClose: true,
                    content: '${base}/yue/login'
                });
            },60)


        } else if (isBind == 'true') {
            $('.nav_mask').show();
            $('.l-left-nav').show()
        }
//        if (!isBind) {
//            layer.open({
//                type: 2,
//                title: "验证手机号，方便司机联系您",
//                area: ['95%', '255px'], //宽高,
//                shadeClose: true,
//                content: '/yue/login'
//            });
//        } else {
//            $('.nav_mask').show();
//            $('.l-left-nav').show()
//        }
    });

    $document.on('touchend', '.nav_mask', function () {
        $('.nav_mask').hide();
        $('.l-left-nav').hide()
    });
    //退出
    $document.on('touchend', '#exit', function () {
        yun.ajax_md5(
            {openId:yun.openId},
            '${base}/wx/passenger/unBind',
            function (data) {
                delLocalStorage('ifBindWxUser');
                delLocalStorage('yueuser');
                delLocalStorage('validateOpenId');
                delLocalStorage('subStatus');
                delLocalStorage('hasOrder');
                delLocalStorage('comment');
                delLocalStorage('actualMobile');
                delLocalStorage('Estimate');
                window.location.reload();
            },
            function (data) {
                layer.msg(data.msg)
            }
        )
    });

    //侧边栏 END

    //呼叫出租车
    $document.on('touchend', '.btn-call-abled', function () {
        // if($(this).hasClass('btn-call-disabled')){
        //     return;
        // }
        var isBind = getLocalStorage('ifBindWxUser', 'string');
        if (isBind == 'true') {
            isBind = true;
        } else if (isBind == 'false') {
            isBind = false;
        }
        //调用后台接口，判断该OpenId是否绑定乘客，如果没有则注册乘客或者更新乘客
        if (!isBind) {
            setTimeout(function(){
                layer.open({
                    type: 2,
                    title: "验证手机号，方便司机联系您",
                    area: ['92%', '235px'], //宽高,
                    shadeClose: true,
                    content: '${base}/yue/login'
                });
            },60)
        } else {
            var hasOrder = +getLocalStorage('hasOrder', 'string');
            var subStatus = getLocalStorage('subStatus', 'string');
            //查找是否有进行中的订单，如果有就跳转页面到进行中的订单
            if (hasOrder != 0) {
//                changeUrl(subStatus);
            } else {
                var url = "${base}/api/v1/passenger/token/order/addRealtime";
                //起始点距离
                var routeInfo = getLocalStorage('routeInfo', 'object');
                // 起点信息
                var startLocation = getLocalStorage(START_LOCATION_INFO, 'object');
                // 终点信息
                var endLocation = getLocalStorage(END_LOCATION_INFO, 'object');
                // 预估价信息
                var Estimate = getLocalStorage(estimate, 'object');

                var departTime = getTimeStemp();//预约单有的预约时间
                var actualMobile = "";
                if ($('#changeCustomerSpan').text().startsWith("尾号")) {
                    actualMobile = getLocalStorage('actualMobile','string');//实际乘车人电话，只有写了换乘车人才有值
                }

                // 判断是否在预约时间内
                // var isDepartTime = !departTime? false : (departTime-1000*60*30)>= (new Date().getTime());
                var dataBody={
                    'planDuration':Math.ceil(routeInfo.time / 60),// 预估时长
                    "source": 2,// 来源
                    "typeEnt": 1,// 订单类型（个人/企业）：1 个人；2 企业
                    "typeModule": 1,// 订单模块类型（1：出租车，2：专车，3：拼车，4：快车，5：货的，6：骑手，7：搬家）
                    "typeTrip": 1,//订单行程类型（1：用车，2：日租，3：半日租，4：送机，5：接机）
                    "typeTime": !departTime?1:2 ,// 订单时效类型（1：实时，2：预约）
                    "prepayType": 2,// 预支付方式（1企业支付，2个人支付）
                    "typeSelf": actualMobile==""?1:2,//订单类型（本人/代客）：1 本人；2 代客
                    "originCity": startLocation.city,
                    "originAddress": startLocation.name,
                    "originDetailAddress": startLocation.district?startLocation.district + startLocation.address: startLocation.province + startLocation.city + startLocation.name,
                    "destCity": endLocation.city,
                    "destAddress": endLocation.name,
                    "destDetailAddress": endLocation.district?endLocation.district + endLocation.address: endLocation.province + endLocation.city + endLocation.name,
                    "originAreaCode":startLocation.adcode,
                    "destAreaCode": endLocation.adcode,
                    "originLng": startLocation.location.lng,
                    "originLat": startLocation.location.lat,
                    "destLng": endLocation.location.lng,
                    "destLat": endLocation.location.lat,
                    "planTrip": routeInfo.distance / 1000,//预估里程(公里)  (单位是米/m)  取时间 routeInfo.time (单位是秒/s),
                    // "planDuration": 5,
                    "deparTime": departTime?departTime:'',//出发时间
                    // "carModelUuid": Estimate.carModelValuationUuid,
                    // "carModelValuationUuid": Estimate.carModelValuationUuid,
                    'passengerName': '',// 实际乘车人
                    'passengerMobile': actualMobile,
                    'serviceFare':$('#dispatchSpan').data('tip') || '',//小费
                    'remark':($('#oralMessageSpan').data('msg')|| '')//订单留言
                }
                var $self = $(this)
                $self.removeClass('btn-call-abled')
                $self.addClass('btn-call-disabled')
                yun.ajax_md52(dataBody
                    ,'${base}/api/v2/passenger/order/create'
                    , function(data){
                        layer.msg('下单成功，正在跳转页面')
                        changeUrl(data.data.subStatus, data.data.uuid);
                    }
                    ,function(error){
                        $self.addCall('btn-call-abled')
                        $self.removeClass('btn-call-disabled')
                        delLocalStorage(inOrder);
                        layer.msg(error.msg);
                    }
                    ,'POST')
            }
        }
    });

    // 起点输入touchend
    $document.on('touchend', '#qidian_input', function (event) {
        event.stopPropagation();
        // 禁止弹出软键盘
        document.activeElement.blur();

        var city = defaultCity
        var startloca=getLocalStorage(START_LOCATION_INFO,'object')
        if($('#qidian_input').html()!='您从哪上车'){
            city = startloca.city || defaultCity
        }
        setLocalStorage('city',city)

        setInputValue('addr/transfer', 'qidian_input', START_LOCATION_INFO);
    });

    // 终点输入
    $document.on('touchend', '#zhongdian_input', function (event) {
        event.stopPropagation();
        // 禁止弹出软键盘
        document.activeElement.blur();
        var city = defaultCity
        var endloca=getLocalStorage(END_LOCATION_INFO,'object')
        var startloca=getLocalStorage(START_LOCATION_INFO,'object')
        if($('#zhongdian_input').html()!='您要去哪儿'){
            city = endloca.city || startloca.city || defaultCity
        }else{
            city = startloca.city || defaultCity
        }
        setLocalStorage('city',city)
        setInputValue('end', 'zhongdian_input', END_LOCATION_INFO);
    });

    // 输入换乘客人联系方式
    $document.on('touchend', '#changeCustomer', function () {
        layer.open({
            type: 2,
            title: "   ",
            //skin: 'layui-layer-rim', //加上边框
            area: ['80%', '260px'], //宽高,
            shadeClose: false,
            content: '${base}/yue/inputPhone',
//            closeBtn: false
        });
//        addExtraCloseBtn();
    });
//捎话
    $document.on('click','#oralMessage',function(){
        layer.open({
            type: 2,
            title: false,
            closeBtn: false,
            //skin: 'layui-layer-rim', //加上边框
            area: ['100%', '100%'], //宽高,
            shadeClose: true,
            anim: 'up',
            content: '${base}/yue/takeMsg?msg='+($('#oralMessageSpan').data('msg')||''),
            offset: 'lb',
            success:function(index){
                index.addClass('notradius')
            }
        });
    })
    //选择稍话
    $document.on('click','#dispatch',function(){
     var num=(function(){
         var i=[];
         for(var j=0;j<=50;j++){
             i.push({
                 id:j,
                 value:j
             })
         }
         return i;
     })()
        var that=$(this)
        var tip=new IosSelect(1,[num],{
            container: '.container',
            title: '选择调度费用',
            itemHeight: 50,
            itemShowCount: 3,
            oneLevelId: $('dispatchSpan').data('tip') || 0,
            callback: function (selectOneObj) {
                $('#dispatchSpan').html('调度费'+(selectOneObj.value==0?'': selectOneObj.value+'元'));
                $('#dispatchSpan').data('tip',selectOneObj.value);
            }
        })
    })
    // 自定义关闭按钮
    $document.on('touchend', '#closeExtra', function (event) {
        layer.closeAll();
        $(this).parent('.closeExtraDiv').remove();
    });



    // 取消
    $document.on('touchend', "#cancelBtn", function (event) {
        $('.amap-sug-result').remove();
        // 如果是起点输入取消时，需要设置定位信息
//        var currentL = getLocalStorage(START_LOCATION_INFO, 'object');
//        setName(currentL.name, currentL.adcode);
        $('#historyBox').addClass('hide').html('');
        $('#searchBox').html('');
        $('#containerBox').removeClass('hide');
        $('.l-footer').removeClass('hide');
        letShow();
        $('.kucity').hide();
    });

    // 起始点搜索input获取焦点监听
    $document.on('focus', "#tipinput", function (event) {
        $('.searchResultList').addClass('hide');
        $('.kucity').hide();
        appendHistory();
    });

    // 起始点搜索input输入监听
    $document.on('keyup input propertychange', "#tipinput", function (event) {

        var $this = $(this),
            keyword = $this.val();

        if (keyword.length > 0) {
            $('#input_delete').removeClass('hide');
            autoComplete(keyword);
        } else {
            $('#input_delete').addClass('hide');
        }
        $('#historyBox').addClass('hide').html('');
    });

    // 历史记录点击
    var toucheFlag = false;
    $document.on('touchstart touchmove touchend', '.history-item', function (event) {
        event.stopPropagation();
        switch (event.type) {
            case 'touchstart':
                toucheFlag = false;
                break;
            case 'touchmove':
                toucheFlag = true;
                break;
            case 'touchend':
                if (!toucheFlag) {
                    var $this = $(this);
                    var $div = $this.clone();
                    $div.find(':nth-child(n)').remove();
                    var name = $div.html();
                    var data = $this.data('item');
                    setName(name,data);
                    letShow();
                    search(data);
                    calculate(yun);
                }
                toucheFlag = false;
                break;
        }
    });

    function setInputValue(from, to, curLocation) {
        $('#containerBox').addClass('hide');
        $('.l-footer').addClass('hide');
        $('#searchBox').removeClass('hide');
        $('#searchBox').load('${base}/yue/' + from);
        $('#curLocation').val(curLocation);
        $('#inputId').val(to);
    }

    function addExtraCloseBtn() {
        var $layer = $('.layui-layer'),
            height = $layer.css('height'),
            top = $layer.css('top'),
            width = $layer.css('width'),
            left = $layer.css('left'),
            zIndex = $layer.css('z-index');

        var $close = $('<div class="closeExtraDiv"><a id="closeExtra" href="javascript:void(0);" style="display: inline-block;"><img src="/images/closeImg.png" /></a></div>');
        var $close = $('<div class="closeExtraDiv">X</div>');

//        top = +(top.substring(0, top.indexOf('px')));
//        height = +(height.substring(0, height.indexOf('px')));
        top = +0;
        height = +0;

        $close.animate({
            'z-index': zIndex,
            'width': width,
            'height': '35px',
            'top': (top + height) + 'px',
            'left': left
        }).find('img').css('height', '80px');

        $close.insertAfter($layer);
    }

    function setFirstCarType(data) {
        //默认先用舒适型来预估
        var first = data[0];
        var $trigger = $('#carTypeText');
        $trigger.data('id', first.uuid);
        $trigger.data('value', first.modelName);
        $trigger.text(first.modelName);
        <%--debugger--%>
        <%--valuation('${sessionScope.passengerUuid}',first.uuid);--%>
    }

//    var promise = getCarTypeFromService();
//    promise.then(function (data) {
//        alert('00000000000')
//        console.log('-------------------0000');
//        console.log(data);
//        setFirstCarType(data);
//        setLocalStorage('carTypeData', data);
//    });

    function appendHistory() {
        var divHtml = "<div class='amap-sug-result'>";
        var searchHistory = getLocalStorage('searchHistory', 'object');
        if (searchHistory) {
            var len = searchHistory.length;
            if (len > 0) {
                for (var i = 0; i < len; i++) {
                    var item = searchHistory[i];
                    var dataStr = JSON.stringify(item);
                    divHtml += "<div data-item='" + dataStr + "' class='auto-item history-item'" +
                        " id='amap-sug" + i + "'>" + item.name + "<span class='auto-item-span'>" +
                        (item.district || (item.province + item.city + item.name))  + "</span></div>";
                }
                divHtml += "</div>";
                $('#historyBox').removeClass('hide').html(divHtml);
            } else {
                $('#historyBox').addClass('hide').html('');
            }
        }
    }

    function initStartInputData() {
        return;
        var $qidian = $('#qidian_input');
        var currentLocation = getLocalStorage(START_LOCATION_INFO, "object");
//            加入判断此时是否已经存在当前用户定位信息
        if(!currentLocation){
            setTimeout(function(){initStartInputData()},30);
        }else{
            var location = currentLocation.location;
//            var optionHtml = '<option value="' + currentLocation.adcode + '" data-city="' + currentLocation.district + '" data-lng="' + location.lng + '" data-lat="' + location.lat + '" selected>' + currentLocation.name + '</option>';
//            $qidian.html(optionHtml);
            $qidian.html(currentLocation.name);
            $qidian.data({
                name: currentLocation.name
            })
        }

    }
</script>
</html>